import 'package:flutter/material.dart';
import 'package:flutter2/colors.dart';

class NormalButton extends StatelessWidget {
  const NormalButton({
    super.key,
    this.text,
    this.enable = true,
    this.fontSize,
    this.fontColor = Colors.white,
    this.click,
    this.disableClick,
    this.width,
    this.height,
    this.margin,
    this.radius,
    this.background,
  });

  final String? text;
  final bool enable;
  final double? fontSize;
  final Color? fontColor;
  final Function()? click;
  final Function()? disableClick;
  final double? width;
  final double? height;
  final EdgeInsetsGeometry? margin;
  final double? radius;
  final Color? background;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: margin,
      width: width,
      height: height ?? 44,
      child: ElevatedButton(
        onPressed: () {
          if (enable) {
            click?.call();
          } else {
            disableClick?.call();
          }
        },
        style: ElevatedButton.styleFrom(
          shadowColor: Colors.transparent,
          overlayColor: Colors.transparent,
          foregroundColor: Colors.transparent,
          backgroundColor: enable ? background ?? btnColor : disableColor,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(
              Radius.circular(radius ?? 10),
            ),
            side: BorderSide(
              color: btnColor,
              width: 1,
            ),
          ),
        ),
        child: Text(
          text ?? "",
          style: TextStyle(
            fontSize: fontSize,
            color: fontColor,
          ),
        ),
      ),
    );
  }
}
